
#!/bin/bash
# Create:    zhangyu
# Base percona-toolkit-2.2.19

diff=$(
\mysql -s -q --skip-column-names -url -pxxx db1 2>/dev/null <<EOF
select timestampdiff(second,loc.hb_time,src.hb_time) secs 
from sync_hbt loc,master_sync_hbt src;
EOF
)

\mysql -s -q -uroot -pxxx db1 -h10.10.10.11 <<EOF
insert into monitor_sync
values(now(),$diff);
commit;
EOF

if [ $diff -gt 60 ]
then
  echo warning
  python /root/DBAScripts/weixin.py xxx lathigh lathigh${diff}
fi